﻿<template>
  <a-modal
    title="新增费用明细"
    :width="900"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleSubmit"
    @cancel="handleCancel">
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-form-item label="个人编码" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入个人编码" v-decorator="['psnNo']" />
        </a-form-item>
        <a-form-item label="费用明细流水号单次就诊内唯一 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入费用明细流水号单次就诊内唯一 " v-decorator="['feedetlsn']" />
        </a-form-item>
        <a-form-item label="就诊ID " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入就诊ID " v-decorator="['mdtrtid']" />
        </a-form-item>
        <a-form-item label="人员编号 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入人员编号 " v-decorator="['psnno']" />
        </a-form-item>
        <a-form-item label="收费批次号同一收费批次号病种编号必须一致 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入收费批次号同一收费批次号病种编号必须一致 " v-decorator="['chrgbchno']" />
        </a-form-item>
        <a-form-item label="病种编码按照标准编码填写：按病种结算病种目录代码(bydise_setl_lis t_code)、门诊慢特病病种目录代码(opsp_dise_cod) " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入病种编码按照标准编码填写：按病种结算病种目录代码(bydise_setl_lis t_code)、门诊慢特病病种目录代码(opsp_dise_cod) " v-decorator="['disecodg']" />
        </a-form-item>
        <a-form-item label="处方号外购处方时，传入外购处方的处方号；非外购处方，传入医药机构处方号 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入处方号外购处方时，传入外购处方的处方号；非外购处方，传入医药机构处方号 " v-decorator="['rxno']" />
        </a-form-item>
        <a-form-item label="外购处方标志 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入外购处方标志 " v-decorator="['rxcircflag']" />
        </a-form-item>
        <a-form-item label="费用发生时间yyyy-MM-ddHH:mm:ss " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-date-picker style="width: 100%" placeholder="请选择费用发生时间yyyy-MM-ddHH:mm:ss " v-decorator="['feeocurtime']" @change="onChangefeeocurtime"/>
        </a-form-item>
        <a-form-item label="医疗目录编码 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入医疗目录编码 " v-decorator="['medlistcodg']" />
        </a-form-item>
        <a-form-item label="医药机构目录编码 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入医药机构目录编码 " v-decorator="['medinslistcodg']" />
        </a-form-item>
        <a-form-item label="明细项目费用总额 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入明细项目费用总额 " v-decorator="['detitemfeesumamt']" />
        </a-form-item>
        <a-form-item label="数量 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入数量 " v-decorator="['cnt']" />
        </a-form-item>
        <a-form-item label="单价 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入单价 " v-decorator="['pric']" />
        </a-form-item>
        <a-form-item label="单次剂量描述 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入单次剂量描述 " v-decorator="['sindosdscr']" />
        </a-form-item>
        <a-form-item label="使用频次描述 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入使用频次描述 " v-decorator="['usedfrqudscr']" />
        </a-form-item>
        <a-form-item label="周期天数 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入周期天数 " v-decorator="['prddays']" />
        </a-form-item>
        <a-form-item label="用药途径描述 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入用药途径描述 " v-decorator="['medcwaydscr']" />
        </a-form-item>
        <a-form-item label="开单科室编码 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入开单科室编码 " v-decorator="['bilgdeptcodg']" />
        </a-form-item>
        <a-form-item label="开单科室名称 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入开单科室名称 " v-decorator="['bilgdeptname']" />
        </a-form-item>
        <a-form-item label="开单医生编码按照标准编码填写 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入开单医生编码按照标准编码填写 " v-decorator="['bilgdrcodg']" />
        </a-form-item>
        <a-form-item label="开单医师姓名 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入开单医师姓名 " v-decorator="['bilgdrname']" />
        </a-form-item>
        <a-form-item label="受单科室编码 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入受单科室编码 " v-decorator="['acorddeptcodg']" />
        </a-form-item>
        <a-form-item label="受单科室名称 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入受单科室名称 " v-decorator="['acorddeptname']" />
        </a-form-item>
        <a-form-item label="受单医生编码按照标准编码填写 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入受单医生编码按照标准编码填写 " v-decorator="['ordersdrcode']" />
        </a-form-item>
        <a-form-item label="受单医生姓名 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入受单医生姓名 " v-decorator="['ordersdrname']" />
        </a-form-item>
        <a-form-item label="医院审批标志 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入医院审批标志 " v-decorator="['hospapprflag']" />
        </a-form-item>
        <a-form-item label="中药使用方式 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入中药使用方式 " v-decorator="['tcmdrugusedway']" />
        </a-form-item>
        <a-form-item label="外检标志 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入外检标志 " v-decorator="['etipflag']" />
        </a-form-item>
        <a-form-item label="外检医院编码按照标准编码填写 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入外检医院编码按照标准编码填写 " v-decorator="['etiphospcode']" />
        </a-form-item>
        <a-form-item label="出院带药标志 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入出院带药标志 " v-decorator="['dscgtkdrugflag']" />
        </a-form-item>
        <a-form-item label="生育费用标志 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入生育费用标志 " v-decorator="['matnfeeflag']" />
        </a-form-item>
        <a-form-item label="原费用流水号退单时传入被退单的费用明细流水号 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入原费用流水号退单时传入被退单的费用明细流水号 " v-decorator="['initfeedetlsn']" />
        </a-form-item>
        <a-form-item label="医嘱号 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入医嘱号 " v-decorator="['drordno']" />
        </a-form-item>
        <a-form-item label="医疗类别 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入医疗类别 " v-decorator="['medtype']" />
        </a-form-item>
        <a-form-item label="备注 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入备注 " v-decorator="['memo']" />
        </a-form-item>
        <a-form-item label="扩展字段可参考FSI的接口要求 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入扩展字段可参考FSI的接口要求 " v-decorator="['expcontent']" />
        </a-form-item>
        <a-form-item label="医疗目录名称 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入医疗目录名称 " v-decorator="['medlistname']" />
        </a-form-item>
        <a-form-item label="医疗目录规格 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入医疗目录规格 " v-decorator="['medlistspc']" />
        </a-form-item>
        <a-form-item label="组套编号可参考FSI的接口要求 " :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入组套编号可参考FSI的接口要求 " v-decorator="['combno']" />
        </a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>

<script>
  import {
    Nitf6201InputFeedetailAdd
  } from '@/api/modular/main/Nitf6201InputFeedetailManage'

  export default {
    data () {
      return {
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 15 }
        },
        feeocurtimeDateString: '',
        visible: false,
        confirmLoading: false,
        form: this.$form.createForm(this)
      }
    },
    methods: {
      // 初始化方法
      add (record) {
        this.visible = true
      },
      /**
       * 提交表单
       */
      handleSubmit () {
        const { form: { validateFields } } = this
        this.confirmLoading = true
        validateFields((errors, values) => {
          if (!errors) {
            for (const key in values) {
              if (typeof (values[key]) === 'object') {
                values[key] = JSON.stringify(values[key])
              }
            }
            values.feeocurtime = this.feeocurtimeDateString
            Nitf6201InputFeedetailAdd(values).then((res) => {
              if (res.success) {
                this.$message.success('新增成功')
                this.confirmLoading = false
                this.$emit('ok', values)
                this.handleCancel()
              } else {
                this.$message.error('新增失败：' + JSON.stringify(res.message))
              }
            }).finally((res) => {
              this.confirmLoading = false
            })
          } else {
            this.confirmLoading = false
          }
        })
      },
      onChangefeeocurtime(date, dateString) {
        this.feeocurtimeDateString = dateString
      },
      handleCancel () {
        this.form.resetFields()
        this.visible = false
      }
    }
  }
</script>
